package com.citywithincity.redis.utils;

import redis.clients.jedis.Pipeline;
import redis.clients.jedis.Response;

public class PiplineUtil {
	/**
	 * 
	 * @param jedis
	 * @param ecardAccountToId
	 * @param acc
	 */
	public static void hset(Pipeline jedis, String key, String subKey, String value) {
		if(subKey.length()>3){
			int part = 3;
			String part1 = subKey.substring(0,part);
			String part2 = subKey.substring(part);
			jedis.hset(RedisUtil.getKey(key,part1), part2, value);
		}else{
			jedis.hset(key, subKey, value);
		}
	}
	
	public static Response<String> hget(Pipeline jedis, String key, String subKey){
		if(subKey.length()>3){
			int part = 3;
			String part1 = subKey.substring(0,part);
			String part2 = subKey.substring(part);
			return jedis.hget(RedisUtil.getKey(key,part1), part2);
		}else{
			return jedis.hget(key, subKey);
		}
	}
}
